﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace TCS.Web.Admin.AdministrativeManage
{
    public partial class modify : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
               

                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    string id = Request.Params["id"];
                    ShowInfo(int.Parse(id));
                }
                else
                {
                    Response.Redirect("index.aspx");
                    Response.End();
                }
            }
        }

        

        private void ShowInfo(int id)
        {
            Navigation011.Para_Str = "id=" + id;
            TCS.BLL.Gsp_Administrative bll = new TCS.BLL.Gsp_Administrative();
            TCS.Model.Gsp_Administrative model = bll.GetModel(id);
            this.lblClassId.Text = model.AddID.ToString();

            this.txtAddName.Text = model.AddName.ToString();
            this.txtRemark.Text = model.Remark;


        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            int classid = int.Parse(lblClassId.Text);
            string AddName = this.txtAddName.Text;
            string Remark = this.txtRemark.Text;

            TCS.Model.Gsp_Administrative model = new TCS.Model.Gsp_Administrative();
            model.AddID = classid;
            model.AddName = AddName;
            model.Remark = Remark;

            TCS.BLL.Gsp_Administrative bll = new TCS.BLL.Gsp_Administrative();
            bll.Update(model);
            Response.Redirect("index.aspx?id=" + classid);
        }
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("index.aspx");
        }
    }

}
